import { Http } from "@/utils/request";
import { Toast } from "@/utils/toast";
import { delayTask } from "@/utils/timer";

const baseUrl = "/mini_app_tour_pay";

export const pay_api = (data: { pre_order_id: string }, showError = true) => {
  return Http.post<any>(`/v1${baseUrl}/pay`, data).catch((error: Error) => {
    showError && delayTask(60, () => Toast.show(error.message));
    return Promise.reject(error);
  });
};
